package com.steel.yfmall.cloud.assistant.controller;

import com.alibaba.fastjson.JSON;
import com.steel.yfmall.cloud.assistant.api.stock.CqUploadImageAndFileAPI;
import com.steel.yfmall.cloud.assistant.api.stock.ErpUserAccountsServiceAPI;
import com.steel.yfmall.cloud.assistant.bean.param.APIFileInfoBean;
import com.steel.yfmall.cloud.assistant.bean.param.APIParamUserAccounts;
import com.steel.yfmall.cloud.assistant.bean.result.APIResultErpUserAccounts;
import com.steel.yfmall.cloud.components.utils.base.APIListBean;
import com.steel.yfmall.cloud.components.utils.base.APIMsgBean;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @program: CqUploadImageAndFileController
 * @author: liuzhijun
 * @date: 2021-04-19 15:54
 **/
@RestController
@Slf4j
public class CqUploadImageAndFileController {


    /**
     * 上传图片到苍穹
     *
     * @param apiFileInfoBeanList
     * @return com.steel.yfmall.cloud.components.utils.base.APIListBean<com.steel.yfmall.cloud.assistant.bean.param.APIFileInfoBean>
     * @author liuzhijun
     * @date 2021/4/19 15:56
     */
    @RequestMapping(value = "uploadImage")
    public APIListBean<APIFileInfoBean> uploadImage(@RequestBody List<APIFileInfoBean> apiFileInfoBeanList) {
        if (log.isDebugEnabled()) {
            log.info("function uploadImage :" + JSON.toJSONString(apiFileInfoBeanList));
        }
        return cqUploadImageAndFileAPI.uploadImage(apiFileInfoBeanList);
    }


    /**
     * 根据图片url查询图片base64信息
     *
     * @param apiFileInfoBeanList
     * @return com.steel.yfmall.cloud.components.utils.base.APIListBean<com.steel.yfmall.cloud.assistant.bean.param.APIFileInfoBean>
     * @author liuzhijun
     * @date 2021/4/19 15:56
     */
    @RequestMapping(value = "queryImageUrlList")
    public APIListBean<APIFileInfoBean> queryImageUrlList(@RequestBody List<APIFileInfoBean> apiFileInfoBeanList) {
        if (log.isDebugEnabled()) {
            log.info("function queryImageUrlList :" + JSON.toJSONString(apiFileInfoBeanList));
        }
        return cqUploadImageAndFileAPI.queryImageUrlList(apiFileInfoBeanList);
    }

    @Resource
    private CqUploadImageAndFileAPI cqUploadImageAndFileAPI;

}
